// import { app, BrowserWindow, ipcMain } from 'electron';
// import { join } from 'path';
const electron = require("electron");
const BrowserWindow = electron.BrowserWindow;
const app = electron.app

const path = require("path");
const getMac = require("getmac").default;

const createWindow = () => {
	const win = new BrowserWindow({
		width: 1200,
		height: 800,
		minWidth: 960,
		minHeight: 600,
		webPreferences: {
			nodeIntegration: true, // 设置是否在页面中启用 Node.js 集成模式
			contextIsolation: true, // 设置是否启用上下文隔离模式。
			webviewTag: true, // 开启webview
			// frame: false // 这里设置为false，禁用默认的浏览器窗口框架。
			preload: path.resolve(__dirname, 'preload.js'),
			partition: String(+new Date())
		},
	});
	win.setTitle('正晶教育');
	// win.setMenu(null);  // 取消顶部菜单栏
	win.loadFile(path.join(__dirname, '../dist/index.html'));
	// if (process.env.VITE_DEV_SERVER_URL) {
	// 	win.loadURL(process.env.VITE_DEV_SERVER_URL);
	// } else {
	// 	win.loadFile(join(__dirname, '../dist/index.html'));
	// }
	//   console.log("中文！！");
	
	let mac = getMac();
	console.log("MAC地址是:", mac);
	// let mac = getMac();
	// win.webContents.send('macAddress',mac)
	// ipcMain.on('message-from-renderer', (event, arg) => {
	// 	console.log(arg); // 将会打印 "Hello from Vue!"
	// 	event.reply('message-from-main', getMac());
	// });
	// win.send('macAddress', mac);
	// win.webContents.openDevTools();
	win.webContents.send('mac', mac);
};

app.whenReady().then(createWindow);

